﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="QuanlytinDoanhNghiep.aspx.cs" Inherits="WebHousingInfo.QuanlytinDoanhNghiep" %>
<%@ Register Src="~/Controls/Header.ascx" TagName="HD" TagPrefix="Header" %>
<%@ Register Src="~/Controls/ManagerUser_left.ascx" TagName="ManagerUserLeft" TagPrefix="Userleft" %>
<%@ Register Src="~/Controls/ManagerUser_Right.ascx" TagName="ManagerUserRight" TagPrefix="Userright" %>
<%@ Register Src="~/Controls/MenuFooter.ascx" TagName="MenuDuoi" TagPrefix="MenuFooter" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Trang Quản lý tin Doanh Nghiệp</title>
</head>
<body>
    <form id="form1" runat="server">
    <div id="uni_wrapper">
        <script type="text/javascript">
            function confirmAction()
             {
                if(confirm('Bạn chắn chắn muốn xoá các tin Doanh Nghiệp được chọn ?'))
                {
                    // you clicked the OK button.
                    // you can allow the form to post the data.
                    return true;
                }
                else 
                    // you clicked the Cancel button.
                    // you can disallow the form submission.
                    return false;
             }    
             
             function confirmketthuc()
             {
                if(confirm('Bạn chắc chắn muốn kết thúc đăng tin của các tin Doanh Nghiệp đựơc chọn ?'))
                {
                    // you clicked the OK button.
                    // you can allow the form to post the data.
                    return true;
                }
                else 
                    // you clicked the Cancel button.
                    // you can disallow the form submission.
                    return false;
             }         
        </script> 
        <script type="text/javascript">
            function SelectAll(CheckBox)
            {
                TotalChkBx = parseInt('<%= this.GridView1.Rows.Count %>');    
                var TargetBaseControl = document.getElementById('<%= this.GridView1.ClientID %>');
                var TargetChildControl = "chkSelect";   
                var Inputs = TargetBaseControl.getElementsByTagName("input");
                for(var iCount = 0; iCount < Inputs.length; ++iCount)
                {                
                    if(Inputs[iCount].type == 'checkbox' && Inputs[iCount].id.indexOf(TargetChildControl,0) >= 0)
                        Inputs[iCount].checked = CheckBox.checked;   
                }

            }
            
            function SelectDeSelectHeader(CheckBox)
            {        
                TotalChkBx = parseInt('<%= this.GridView1.Rows.Count %>');    
                var TargetBaseControl = document.getElementById('<%= this.GridView1.ClientID %>');
                var TargetChildControl = "chkSelect";   
                var TargetHeaderControl = "chkSelectAll";   
                var Inputs = TargetBaseControl.getElementsByTagName("input");
                var flag = false;
                var HeaderCheckBox;
                for(var iCount = 0; iCount < Inputs.length ; ++iCount)
                {    
                    if(Inputs[iCount].type == 'checkbox' && Inputs[iCount].id.indexOf(TargetHeaderControl,0) >= 0)            
                        HeaderCheckBox = Inputs[iCount];            
                    if(Inputs[iCount] != CheckBox && Inputs[iCount].type == 'checkbox' && Inputs[iCount].id.indexOf(TargetChildControl,0) >= 0 && Inputs[iCount].id.indexOf(TargetHeaderControl,0) == -1)
                    {            
                        if(CheckBox.checked)
                        {                    
                            if(!Inputs[iCount].checked)                    
                            {                    
                                flag = false;
                                HeaderCheckBox.checked = false;                       
                                return;
                            }
                            else
                                flag = true;                    
                        }
                        else if(!CheckBox.checked)                
                            HeaderCheckBox.checked = false;                                                       
                    }            
                }                      
                if(flag)        
                    HeaderCheckBox.checked = CheckBox.checked        
            }
        </script>                      
	    <div id="uni_main">
	        <Header:HD ID="Header" runat="server" />
	        <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>                    
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>            
		    <div id="content" class="clearfix">
			    <div id="group_6">					        
			        <Userleft:ManagerUserLeft ID="ManagerUserLeft" runat="server" />			                   
				    <div id="group_542">
				        <% var link = Request.QueryString["xemtindoanhnghiep"]; %>
				        <div style="margin-bottom:5px;">
				            <a href="Home.aspx">Trang chủ</a> >> <a href="ThayDoiThongTin.aspx">Quản lý cá nhân</a> >> <% if (link == "dangdang")
                                                                                                              { %><a href="#">Tin Doanh Nghiệp đang đăng</a><%}
                                                                                                              else if (link == "hethan")
                                                                                                              { %><a href="#">Tin Doanh Nghiệp hết hạn</a><%}
                                                                                                              else if (link == "choduyet")
                                                                                                              {%>
                                                                                                                <a href="#">Tin Doanh Nghiệp chờ duyệt</a>
                                                                                                              <% }
                                                                                                              else
                                                                                                              { %><a href="#">Quản lý tin Doanh Nghiệp</a><%} %>
				        </div>	
					    <div class="title_tab_center">
						    <ul>
							    <li class="selected"><a href="DangTin.aspx">Đăng tin Nhà đất</a></li>
						        <li><a href="DangTinDoanhNghiep.aspx">Đăng Tin Doanh nghiệp</a></li>
						    </ul>
					    </div>						    
					    <div class="data">
						    <div class="tit">
                                <asp:Label ID="lbltin" runat="server" Font-Bold="true" Text="TIN ĐANG ĐĂNG"></asp:Label> 
                            </div>
                            <div align="right" style="margin-bottom:5px;">
                                <img src="Images/checkbox_checked.gif" border="0" /> : Là trạng thái đang đăng   <img src="Images/checkbox.gif" border="0" /> : Là trạng thái chưa được đăng
                            </div>
                            <div>						                                        						        
						        <asp:GridView ID="GridView1" class="table_tit" runat="server" AutoGenerateColumns="False" 
                                    CellPadding="4" DataKeyNames="NewsBussinessID" Width="100%" 
                                    onselectedindexchanged="GridView1_SelectedIndexChanged" AllowPaging="True" 
                                    ForeColor="#333333" GridLines="None" 
                                    onrowdatabound="GridView1_RowDataBound" 
                                    onrowcommand="GridView1_RowCommand" 
                                    onpageindexchanging="GridView1_PageIndexChanging" PageSize="15">
                                    <FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
                                    <RowStyle BackColor="#EFF3FB" />
                                    <Columns>
                                        <asp:CommandField ButtonType="Image" SelectImageUrl="~/Admin/img/edit.png" 
                                            ShowSelectButton="True" >
                                            <ItemStyle Width="20px" />
                                        </asp:CommandField>                                      
                                        <asp:TemplateField>
                                            <ItemTemplate>
                                                <asp:CheckBox ID="chkSelect" runat="server" />
                                            </ItemTemplate>
                                            <HeaderTemplate>
                                             <asp:CheckBox ID="chkSelectAll" runat="server" onclick="SelectAll(this);" />                                
                                            </HeaderTemplate>
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle Width="20px" HorizontalAlign="Center" />
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="NewsBussinessID" HeaderText="Mã tin" ReadOnly="True" 
                                            SortExpression="NewsBussinessID" InsertVisible="False" >
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Center" Width="70px" />
                                        </asp:BoundField>
                                        <asp:TemplateField HeaderText="Tên Doanh Nghiệp">
                                            <ItemTemplate>
                                                <asp:LinkButton ID="lbtname" runat="server" CommandName="Xem" 
                                                    Text='<%# Eval("BussinessName") %>'></asp:LinkButton>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Left" />
                                            <ItemStyle HorizontalAlign="Left" />
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="CreatedDate" HeaderText="Ngày đăng" 
                                            SortExpression="CreatedDate" DataFormatString="{0:dd/MM/yyyy}">
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Center" Width="62px" />
                                        </asp:BoundField>
                                        <asp:TemplateField HeaderText="Trạng Thái">
                                            <ItemTemplate>
                                                <asp:CheckBox ID="CheckBox1" runat="server" Enabled="false" Checked='<%# Eval("IsActive") %>' />
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" Width="64px" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:TemplateField>
                                    </Columns>
                                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                    <EditRowStyle BackColor="#2461BF" />
                                    <AlternatingRowStyle BackColor="White" />
                                </asp:GridView>
						    </div>							                				    
						    <div class="footer">
                                <asp:Button ID="btnketthuc" OnClientClick="javascript:return confirmketthuc();" runat="server" class="button05" 
                                    Text="Kết thúc đăng tin" onclick="btnketthuc_Click" />							    
                                <asp:Button ID="btnxoa" OnClientClick="javascript:return confirmAction();" runat="server" Text="Xóa Tin" class="button03" 
                                    onclick="btnxoa_Click" />
						    </div>
					    </div>
				    </div>
			    </div>
			    <div id="group_5">
                    <div id="my_nd">
	                    <div class="title_xe"><a href="#" style="color:#FFFFFF">QUẢN LÝ TIN DNGHIỆP</a></div>		
	                    <div class="content">
		                    <ul>
		                        <li><a href="QuanlytinDoanhNghiep.aspx"><img src="image/all.ico" width="15px" height="15px" border="0" align="absmiddle" />Tất cả tin <asp:Label ID="lbltatca_bussiness" runat="server" Text="[0]"></asp:Label></a></li>
			                    <li><a href="QuanlytinDoanhNghiep.aspx?xemtindoanhnghiep=dangdang"><img src="images/icon_dang.gif" border="0" align="absmiddle" />Tin đang đăng 
                                    <asp:Label ID="lbldangdang_bussiness" runat="server" Text="[0]"></asp:Label></a>
                                </li>
			                    <li><a href="QuanlytinDoanhNghiep.aspx?xemtindoanhnghiep=hethan"><img src="images/icon_xoa.gif" border="0" align="absmiddle" />Tin hết hạn <asp:Label ID="lblhethan_bussiness" runat="server" Text="[0]"></asp:Label></a></li>			    
			                    <li><a href="QuanlytinDoanhNghiep.aspx?xemtindoanhnghiep=choduyet"><img src="images/icon_edit.gif" border="0" align="absmiddle" />Tin chờ duyệt <asp:Label ID="lblchoduyet_bussiness" runat="server" Text="[0]"></asp:Label></a></li>
		                    </ul>
	                    </div>				
                    </div>
					<div id="my_nd">
						<div class="title_mobile"><a href="#" style="color:#FFFFFF">VĂN BẢN NHÀ ĐẤT</a></div>								
						<div class="content">
							<ul>
								<li><a href="Quanlyvanban.aspx"><img src="image/all.ico" width="15px" height="15px" border="0" align="absmiddle" />Tất cả văn bản <asp:Label ID="lblvanbanall" runat="server" Text="[0]"></asp:Label></a></li>
								<li><a href="Quanlyvanban.aspx?xem=dangdang"><img src="images/icon_dang.gif" border="0" align="absmiddle" />Văn bản đang đăng 
									<asp:Label ID="lblvanbandang" runat="server" Text="[0]"></asp:Label></a>
								</li>
								<li><a href="Quanlyvanban.aspx?xem=choduyet"><img src="images/icon_edit.gif" border="0" align="absmiddle" />Văn bản chờ duyệt <asp:Label ID="lblvanbanduyet" runat="server" Text="[0]"></asp:Label></a></li>
							</ul>
						</div>
					</div>
                </div>
		    </div>
		    </ContentTemplate>
            </asp:UpdatePanel>
	    </div>	
	    <MenuFooter:MenuDuoi ID="MenuFooter" runat="server" />
    </div>
    </form>
</body>
</html>
